//    Copyright (C) Kherty.  All rights reserved.
using System.Collections.Generic;

namespace OpenLS.Spreadsheet.Expressions
{
    class ErrorExpression: Expression
    {
        public ErrorExpression(Error error)
        {
            this._error = error;
        }
        public override IEnumerable<Expression> GetSubExpressions()
        {
            yield break;
        }
        internal override Expression Transposed(Cell target)
        {
            return this;
        }
        readonly Error _error;
        internal Error Error { get { return _error; } }
        public override IEnumerable<IDependencyNode> GetPrecedents(EvaluationContext context)
        {
            yield break;
        }

        protected override object GetObjectImp(EvaluationContext context)
        {
            return _error;
        }
        public override Expression Offset(CellRelativeAddress a)
        {
            return this;
        }
        public override string GetText(TextContext context)
        {
             return _error.Code; 
        }
    }

}
